﻿using System;
class solution {
    public static void Main(String[] args)
    {
        Console.WriteLine("请输入矩阵长度:");
        int l = 0;
        l = int.Parse(Console.ReadLine());
        Console.WriteLine("请输入矩阵宽度:");
        int w = 0;
        w= int.Parse(Console.ReadLine());
        Console.WriteLine("请输入矩阵:");
        int[,] a = new int[l, w];
        for (int i = 0; i < l; i++)
        {
            string str = Console.ReadLine();//首先输入一字符串，表示二维数组的一行数据
            string[] tmp = str.Split(" ".ToCharArray());//通过Split方法以空格作为分隔符将输入的一行字符串分隔开
            for (int j = 0; j < w; j++)
            {
                a[i, j] = int.Parse(tmp[j]);//将分割后的字符付给二维数组每个元素
            }
        }
        bool result;
        solution mysolution = new solution();
        result = mysolution.Toeplitz(a, l, w);
        Console.WriteLine(result);
    }
    public bool Toeplitz(int[,] a,int l,int w)
    {
        for(int i = 0; i < l-1; i++)
        {
            for (int j = 0; j < w - 1; j++)
            {
                if (a[i, j] != a[i + 1, j + 1])
                {
                    return false;
                }
            }
        }
        return true;
    }
}
